PLC BLOG | SIGNUP LOGIN PAGE IN PHP WITH DATABASE (MYSQL)
Warning: include(../navbar.php): Failed to open stream: No such file or directory in /home/u658851932/domains/plcblog.in/public_html/php/php sign and signup page template.php on line 54

Warning: include(): Failed opening '../navbar.php' for inclusion (include_path='.:/opt/alt/php82/usr/share/pear:/opt/alt/php82/usr/share/php:/usr/share/pear:/usr/share/php') in /home/u658851932/domains/plcblog.in/public_html/php/php sign and signup page template.php on line 54

Warning: include(../../socialplugin1.php): Failed to open stream: No such file or directory in /home/u658851932/domains/plcblog.in/public_html/socialplugin.php on line 1

Warning: include(): Failed opening '../../socialplugin1.php' for inclusion (include_path='.:/opt/alt/php82/usr/share/pear:/opt/alt/php82/usr/share/php:/usr/share/pear:/usr/share/php') in /home/u658851932/domains/plcblog.in/public_html/socialplugin.php on line 1
lg-12 col-12 fb-share-button">

Share on Facebook

Share on twitter

Share on Whats-App

user registration is most important for website, it helps to manage the record and valuable information of about your visitors/page memebers. complete user registration and signin form in php. In this article, You know how to make a registration form with complete validation like email, mobile.Welcome.Php: When A Visitors Open Your Page I.E. Welcome.Php, If Visitor Are Not Login So Page Redirect To Login Page. If Visitors Dont Have Account On This Website So There Is Register Or Sign Up Option Availble On Sign In Page. After Successfully Registration Or Sign In User Are Access Your Welcome Page. This Is A Very Simple Page With Little Style. You Can Manage As You Want. For Download Complete Source Link Below.

Create A user Register Form

register.php

make a simple user registration form where user enter their details like name, email, mobile no etc. i am using method post.


code for register.php

<form action ="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"; method="POST">

<div class="form_div">
<div class="header_register">
<p>SignUP</p>
<?php include_once('action_register.php'); ?>
<hr>
<p style="text-decoration: none;font-size: 20px;">Already Member
<a href="login.php" style="text-decoration: none;font-size: 20px; 
color: white;"> <u>SIGN IN</u></a></p> 
</div>
	<label for="name">Name</label>
	<input  type="text" class="" name="name" placeholder="Enter Your Name:">
	<hr class="hr_style">
	
<label for="email">Email</label>
	 <input type="email" name="email" placeholder="Enter Your email">
  <hr class="hr_style">
  
	 <label for="password">Password</label>
	<input type="password" name="password" placeholder="Enter password">
  <hr class="hr_style">
  
	<label for="mobile">Mobile</label>
   <input type="number" id="mobile" name="mobile" placeholder="10 digit mobile no">
   <hr class="hr_footer">
   
   <div class="header_register">
  
 <button class="submit_button" name="SIGNUP"  >SIGN UP</button>
 
</div></div> </form>

css style


<style>
input{
width: 70%;padding: 8px 10px;margin-left: 60px;box-sizing: border-box;
display: block; border: 1px solid grey;
border-radius: 6px;font-size: 15px; align-content: center;}

.form_div{
width: 28%;background-color:
 white;box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 
border: 2px solid #6749b6;margin-left: 450px;margin-top: 50px;	}

.form_div label{color:black;font-size: 20px;width: 30%;margin-left: 60px;}

.header_register 
{ background-color: #6749b6;color: white;text-align: center;
font-size: 30px;margin-top: 0px;padding: 10px 20px;}

.hr_style{width: 70%;border:1px solid transparent;}

.submit_button{padding: 10px 20px;background-color: #f2f2f2;border: 1px solid #f2f2f2;font-size: 20px;}
</style>
		

Create A mysql database

CREATE TABLE `user_register` (
  `id` int(200) NOT NULL,
  `name` varchar(1000) NOT NULL,
  `email` varchar(1000) NOT NULL,
  `password` longtext NOT NULL,
  `mobile` bigint(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

sign in form

<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="POST">

<div class="form_div">
<div class="header_register">
<p>SignUP</p>
<?php 
include_once('action_register.php');
?>	
<hr>
<p style="text-decoration: none;font-size: 20px;">Become Member<a href="register.php" style="text-decoration: none;font-size: 20px; color: white;"> <u>Register</u></a></p> 
</div>
	<label for="name">Email</label>
	 <input type="email" name="email" placeholder="Enter Your email">
  <hr class="hr_style">
	 <label for="name">Password</label>
	<input type="password" name="password" placeholder="Enter password">
  <hr class="hr_style">
   <hr class="hr_footer">
   <div class="header_register">
 <button class="submit_button" name="login"  >Login</button>
</div>   </div></form>
	

code/index.php

		<div class="form_div">
<div class="header_register">
<p>SignUP</p>
<?php 
include_once('action_register.php');
?>	
<hr>
<?php  if (isset($_SESSION['email'])) : ?>

<p style="text-decoration: none;font-size: 20px;">WELCOME <br><a  href="?logout" style="text-decoration: none;font-size: 20px; color: white;"> <u>Log Out</u></a>
<br>
<p><?php echo "Email:-".  $_SESSION['email']; ?></p></p> 

</div>   </div>
 <?php endif ?>
 <?php  if (!isset($_SESSION['email'])) : ?>
 <?php 
header('location: login.php');
?>       
 <?php endif ?>

	

action_register.php

	
<?php
session_start();
$errors = array(); 
$db = mysqli_connect('localhost', 'root', 'password', 'database name');
		$classname="errors";
			 if (isset($_POST['SIGNUP'])) {
		// receive all input values from the form
		$email = mysqli_real_escape_string($db, $_POST['email']);
		$name = mysqli_real_escape_string($db, $_POST['name']);
		$password = mysqli_real_escape_string($db, $_POST['password']);
			$mobile = mysqli_real_escape_string($db, $_POST['mobile']);

		// form validation: ensure that the form is correctly filled
		if (empty($name)) { array_push($errors, " name is required"); }
		if (empty($email)) { array_push($errors, " Email is required"); }
		if (empty($password)) { array_push($errors, " enter valid password"); }
		if (empty($mobile)) { array_push($errors, " mobile No. is required"); }
		
		if(strlen($mobile)==10){}	else
{array_push($errors, "enter 10 digit mobile");}		

$record_check = "SELECT * FROM user_register";
$result_check = $db -> query($record_check);
 	$email_check=$mobile_check="";
 if ($result_check->num_rows > 0) {
  // output data of each row
  while($row = $result_check->fetch_assoc()) {
$email_check=  $row['email'];
$mobile_check=  $row['mobile'];
$password_check=  $row['password'];				
  }
} 
 if ($email_check==$email){array_push($errors, "email already exists");}
if ($mobile_check==$mobile){array_push($errors, "mobile no. already exists");}
$password=md5($password); //encryption of password;
		// register user if there are no errors in the form
		if (count($errors) == 0) {
	$sql123 = "INSERT INTO user_register (	name,email,password,mobile ) 
			   VALUES('$name', '$email','$password','$mobile')";
if ($db->query($sql123) === TRUE) {
array_push($errors, "Thanks for submission<h4>");
$_SESSION['email'] = $email;
				$_SESSION['success'] = "You are now logged in";
				header('location: welcome.php');
} 
else { echo "Error: " . $sql123 ;}
}}

if (isset($_POST['login'])) {
		$email = mysqli_real_escape_string($db, $_POST['email']);
		$password = mysqli_real_escape_string($db, $_POST['password']);

if (empty($email)) {array_push($errors, "enter email");}
if (empty($password)) {array_push($errors, "enter password");}
$password=md5($password);
if (count($errors) == 0) {
$query = "SELECT * FROM user_register WHERE email='$email' AND password='$password'";
$results = mysqli_query($db, $query);

if (mysqli_num_rows($results) == 1) {
				$_SESSION['email'] = $email;
				$_SESSION['success'] = "You are now logged in";
				header('location: welcome.php');
			}else {array_push($errors, "Wrong username/password combination");}
			}}
			//log out
	if (isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['email']);
header("location: welcome.php");
}
?>
<?php  if (count($errors) > 0) : ?>
		<?php foreach ($errors as $error) : ?>
			<h5 class="errors" style="color: red;">	<?php echo $error ?></h5>
		<?php endforeach ?>
<?php  endif ?>
	

download Source code


Warning: include(../includecomment.php): Failed to open stream: No such file or directory in /home/u658851932/domains/plcblog.in/public_html/php/php sign and signup page template.php on line 367

Warning: include(): Failed opening '../includecomment.php' for inclusion (include_path='.:/opt/alt/php82/usr/share/pear:/opt/alt/php82/usr/share/php:/usr/share/pear:/usr/share/php') in /home/u658851932/domains/plcblog.in/public_html/php/php sign and signup page template.php on line 367
Mona
July 16, 2025, 7:32 am

https://www.linkedin.com/pulse/%C4%91%C6%A1n-gi%C3%A1-x%C3%A2y-nh%C3%A0-tr%E1%BB%8Dn-g%C3%B3i-t%C3%A2y-ninh-cam-k%E1%BA%BFt-ch%E1%BA%A5t-l%C6%B0%E1%BB%A3ng-c%E1%BA%A1nh-thanh-an-o5ibc/
What's up to every body, it's my first pay a quick visit
of this webpage; this weblog consists of amazing and in fact good material designed for readers.
https://www.linkedin.com/pulse/%C4%91%C6%A1n-gi%C3%A1-x%C3%A2y-nh%C3%A0-tr%E1%BB%8Dn-g%C3%B3i-t%C3%A2y-ninh-cam-k%E1%BA%BFt-ch%E1%BA%A5t-l%C6%B0%E1%BB%A3ng-c%E1%BA%A1nh-thanh-an-o5ibc/

Milton
July 15, 2025, 9:58 pm

https://xaydungtrangtrinoithat.com/nha-thau-xay-dung-tai-buon-ma-thuot-dak-lak-thi-cong-xay-nha-tron-goi/
Hello just wanted to give you a quick heads up. The
text in your content seem to be running off the screen in Firefox.
I'm not sure if this is a formatting issue or something
to do with internet browser compatibility but I thought I'd post to let you know.

The layout look great though! Hope you get the problem solved soon. Thanks https://xaydungtrangtrinoithat.com/nha-thau-xay-dung-tai-buon-ma-thuot-dak-lak-thi-cong-xay-nha-tron-goi/

Carley
July 15, 2025, 6:56 am

https://xaydungtrangtrinoithat.com/xay-nha-tron-goi-tai-chon-thanh-binh-phuoc-nha-thau-xay-dung-uy-tin-va-chuyen-nghiep/
Does your blog have a contact page? I'm having
a tough time locating it but, I'd like to shoot you an email.
I've got some suggestions for your blog you might be interested in hearing.
Either way, great blog and I look forward to seeing it develop over time.

https://xaydungtrangtrinoithat.com/xay-nha-tron-goi-tai-chon-thanh-binh-phuoc-nha-thau-xay-dung-uy-tin-va-chuyen-nghiep/

Jame
July 12, 2025, 12:26 am

https://xaydungtrangtrinoithat.com/xay-nha-tron-goi-tai-hau-giang-nha-thau-xay-dung-uy-tin-va-chuyen-nghiep/
We're a gaggle of volunteers and starting a new scheme in our community.
Your site provided us with helpful information to work on. You have done a formidable process and our
entire community might be thankful to you.

https://xaydungtrangtrinoithat.com/xay-nha-tron-goi-tai-hau-giang-nha-thau-xay-dung-uy-tin-va-chuyen-nghiep/

Freddy
July 9, 2025, 10:13 am

https://xaydungtrangtrinoithat.com/xay-nha-tron-goi-tai-tra-vinh-nha-thau-xay-dung-uy-tin-va-chuyen-nghiep/
Pretty part of content. I simply stumbled upon your
site and in accession capital to claim that I acquire in fact enjoyed
account your weblog posts. Any way I will be subscribing in your feeds or even I achievement you get
entry to persistently fast. https://xaydungtrangtrinoithat.com/xay-nha-tron-goi-tai-tra-vinh-nha-thau-xay-dung-uy-tin-va-chuyen-nghiep/

http://boyarka-Inform.com/
July 7, 2025, 2:44 pm

I do not even know how I finished uup riht here, but
I assumed this post was great. I don't recognize who you might be however definitely you're going to a famous
blogger iif you happen to aren't already. Cheers! http://boyarka-Inform.com/


Warning: include_once(../../googleaaaaaaaaaososoakl/include_cookies.php): Failed to open stream: No such file or directory in /home/u658851932/domains/plcblog.in/public_html/footer.php on line 163

Warning: include_once(): Failed opening '../../googleaaaaaaaaaososoakl/include_cookies.php' for inclusion (include_path='.:/opt/alt/php82/usr/share/pear:/opt/alt/php82/usr/share/php:/usr/share/pear:/usr/share/php') in /home/u658851932/domains/plcblog.in/public_html/footer.php on line 163

Warning: include_once(../../googleaaaaaaaaaososoakl/include_logic.php): Failed to open stream: No such file or directory in /home/u658851932/domains/plcblog.in/public_html/footer.php on line 164

Warning: include_once(): Failed opening '../../googleaaaaaaaaaososoakl/include_logic.php' for inclusion (include_path='.:/opt/alt/php82/usr/share/pear:/opt/alt/php82/usr/share/php:/usr/share/pear:/usr/share/php') in /home/u658851932/domains/plcblog.in/public_html/footer.php on line 164